<template>
  <main-layout>
    <div class="content">
      <div class="header">
        <div class="title">
          <h4>我的资产</h4>
          <a href="/#/mine/info"><img class="user-icon" :src="userInfo.headIcon" alt=""></a>
        </div>
        <div class="total-money">
          <h4>总资产</h4>
          <p><em>{{userInfo.hashPower}}</em>NGT</p>
        </div>
      </div>

      <!--钱包-->
      <div class="pocket">
        <span class="icon">
          <img src="../../assets/mine/qianbao_icon.png" alt=""><span>钱包</span>
        </span>
        <span class="count">
          <em>{{userInfo.ngt2Balance+userInfo.ngt3Balance}}</em> NGT
        </span>
      </div>

      <div class="split">
        <span class=""></span>
      </div>


      <!-- 通盈宝 -->
      <div class="pocket">
        <span class="icon">
          <img src="../../assets/mine/tongyingbao_icon.png" alt=""><span>通盈宝</span><em>定期高收益</em>
        </span>
         <router-link :to="{name:'Financing',query:{product:productList[0]}}">
        <button type="button" class="mui-btn mui-btn-royal">去享有</button>
        </router-link>
      </div>

      <div class="menus">
          <div class="menus-list" @click="toUrl('PayCenter')">
            <div>
              <img src="../../assets/mine/zichan_icon.png" alt/>
            </div>
            <div class="menus-num">
              <h4>财务中心</h4>
              <div>去中心化数字资产</div>
            </div>
          </div>

        <div class="menus-list">
          <div>
            <img src="../../assets/mine/jiaoyi_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>算力</h4>
            <div>优惠券集合</div>
          </div>
        </div>

        <div class="menus-list">
          <div>
            <img src="../../assets/mine/hongbao_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>提币</h4>
            <div>发送数字货币红包</div>
          </div>
        </div>

        <div class="menus-list" @click="toUrl('Substitute')">
          <div >
            <img src="../../assets/mine/kabao_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>带出</h4>
            <div>数字资产一站交易</div>
          </div>
        </div>

        <div class="menus-list" @click="toUrl('lockcabin')">
          <div>
            <img src="../../assets/mine/xiaokuanggong_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>待释放</h4>
            <div>50元就能挖比特币</div>
          </div>
        </div>

        <div class="menus-list" @click="toUrl('InvitationFriend')">
          <div>
            <img src="../../assets/mine/yaoqing_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>二维码</h4>
            <div>邀请好友获取NCT奖励</div>
          </div>
        </div>

    <!--    <div class="menus-list" @click="toUrl('TransferList')">
          <div>
            <img src="../../assets/mine/qianbao_icon.png" alt/>
          </div>
          <div class="menus-num">
            <h4>转账记录</h4>
            <div>50元就能挖比特币</div>
          </div>
        </div>

        <div class="menus-list" @click="toUrl('DepositList')">
          <div>
            <img src="../../assets/mine/my_not_clicked.png" alt/>
          </div>
          <div class="menus-num">
            <h4>定存记录</h4>
            <div>邀请好友获取NCT奖励</div>
          </div>
        </div> -->
      </div>

    </div>
  </main-layout>
</template>


<script>
  import MainLayout from '../../components/MainLayout';
  import ProductService from '../../service/product';

  export default {
    name: "Login",
    components: {
      //someComponent
      MainLayout
    },
    props: {},
    data() {
      return {
        productList:[],
        productfilter:{
          pageSize:10,
          pageNum:1
        },
        userInfo: JSON.parse(this.$cookie.get('user'))
      }
    },
    computed: {},
    watch: {},
    mounted: function() {
      this.getProductList()
    },
    methods: {
      toUrl(val){
        this.$router.push({ name:val });
      },
      getProductList(){

        ProductService.productList(this.productfilter).then(res=>{
            console.log(res)

          if(res.status == 200){
            this.handleNumber(res.resultData.list)
          }
        })
      },
      handleNumber(list) {
        let obj = list[0]
        console.log(obj);
        let arr = obj.remark.split(" ");
        obj.dailyRatio  = '0.1%-' + Math.ceil(obj.dailyRatio*10)/10
        obj.remark = arr
        console.log(obj)
        this.productList.push(obj)
      }
    }
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .content {
    overflow-y: scroll;
    padding-bottom: 60px;
    background-color: #fff;
  }

  .user-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }

  .header {
    position: relative;
    width: 100%;
    height: 195px;
    background: url("../../assets/mine/bg@2x.png") no-repeat;
    background-position: center;
    background-size: cover;
    padding-top: 25px;
  }

  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
  }

  .title h4 {
    color: #fff;
  }

  .total-money {
    color: #b79150;
    position: absolute;
    bottom: 40px;
    left: 10%;
    text-align: left;
  }

  .total-money p {
    color: #b79150;
  }

  .total-money p em {
    margin-right: 5px;
    font-style: normal;
    font-size: 18px;
    color: #000;
  }

  .pocket {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    margin-top: 15px;
  }

  .pocket .icon img,
  .pocket .icon span {
    vertical-align: middle;
    margin-right: 8px;
  }

  .pocket .icon em {
    display: inline-block;
    font-style: normal;
    color: #ccc;
    font-size: 14px;
  }

  .count {
    color: #c9c9c9;
    font-size: 14px;
  }

  .count em {
    font-size: 18px;
    font-style: normal;
    color: #000;
  }

  .split {
    text-align: right;
  }

  .split span {
    display: inline-block;
    width: 90%;
    height: 0;
    border-bottom: 1px solid #e9e9e9;
    margin: 15px 0;
  }

  .menus {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .menus-list {
    width: 49%;
    background-color: #F6F6F6;
    color: #98a6c8;
    padding: 10px 5px;
    display: flex;
    align-items: center;
    margin-bottom: 5px;
  }

  .menus-num {
    text-align: left;
    margin-left: 5px;
  }

  .menus-num > div {
    font-size: 11px;
  }

</style>
